#include <stdio.h>
#include <kewinternal.h>

#define SOURCE_FILE_NAME "Primitives"


/* FIXME: this can get out of sync with Kew__GenericEqual */
METHOD(Equal)
{
  results[0] = KewNewBool(args[0] == args[1]);
}


/* FIXME: this can get out of sync with Kew__GenericHash */
METHOD(Hash)
{
  results[0] = KewNewInt((int)args[0]);
}


METHOD(Version)
{
  results[0] = KewWrapString(KewVersion());
}


METHOD(Copyright)
{
  results[0] = KewWrapString(KewCopyright());
}


KewObjectType KewPrimitivesType = {
  SOURCE_FILE_NAME, __LINE__,
  0,
  {
    {"=", Equal, 2, 1},
    {"hash", Hash, 1, 1},
    {"version", Version, 0, 1},
    {"copyright", Copyright, 0, 1},
    {NULL, NULL, 0, 0}
  }
};


void
Kew__InitPrimitives(void)
{
  KewPrimitives = KewNewObject(&KewPrimitivesType);
}
